<script  language="javascript">
	$(document).ready(function(){
    	$("#CategoryName").blur(function () {
			var title = $("#CategoryName").val();
			$.get("<?=$html->url('/categories/convertAlias/')?>"+title,
			function(title)
			{
			$("#CategoryAlias").val(title); 
			});		
    	});

  });
</script>
<ul id="list-toolbar">
	<li><?php echo $html->link(__('Danh sách chủ điểm', true), array('action'=>'index'));?></li>
	<li><?php echo $html->link(__('Xóa', true), array('action'=>'delete', $form->value('Category.id')), null, sprintf(__('Are you sure you want to delete # %s?', true), $form->value('Category.id'))); ?></li>	
</ul>


<div class="categories form">
<?php $session->flash();?>
<?php echo $form->create('Category',array('type'=>'file'));?>
	<fieldset>
 		<legend><?php __('Sửa chủ điểm');?></legend>
		<div class="group">
			<div class="lf"><?php __('Chủ điểm cha'); ?></div>
			<div class="rf"><?php echo $form->select('Category.parent_id', array('label' => '', $categories)); ?></div>
		</div>
		<div class="group">
			<div class="lf"><?php __('Kiểu'); ?></div>
			<div class="rf"><?php echo $form->input('Category.type', array('label' => '','options'=>array(1=>'Sản phẩm',0=>'Tin tức'))); ?></div>
		</div>
		<div class="group">
			<div class="lf"><?php __('Tên chủ điểm');?></div>
			<div class="rf"><?php echo $form->input('Category.name', array('label' => '')); ?></div>
		</div>
		<div class="group">
			<div class="lf"><?php __('Alias');?></div>
			<div class="rf"><?php echo $form->input('Category.alias', array('label' => '')); ?></div>
		</div>
		<div class="group">
			<div class="lf"><?php __('Miêu tả');?></div>
			<div class="rf"><?php echo $form->input('Category.description', array('label' => '')); ?></div>
		</div>
	</fieldset>
<?php 
	echo $form->hidden('lang',array('value' => $_SESSION['lang']));
	echo $form->hidden('id');
 ?>
<button type="submit" name="save"><span class="bl1"><span class="bl2"><?=__('Lưu',true) ?></span></span></button>
<?php echo $form->end();?>
</div>
